package com.example.databaseproject;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

import java.util.ArrayList;

public class myAdapter extends BaseAdapter {

    private Context context;
    private ArrayList message;
    public myAdapter(Context context, ArrayList message) {
        this.context = context;
        this.message =message;
    }

    @Override
    public int getCount() {
        return message.size();
    }

    @Override
    public Object getItem(int position) {
        return message.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        TextView mes = (TextView)convertView;
        if (convertView==null){
           convertView = new TextView(context);
           mes = (TextView)convertView;
        }
        mes.setText(position+":"+message.get(position));
        return convertView;
    }
}
